package com.sfh.cpc.com.entity;

import android.os.Build;
import android.os.Parcel;
import android.os.Parcelable;
import android.support.annotation.RequiresApi;
import android.text.TextUtils;

import com.sfh.cpc.com.BaseAppContent;

import java.util.Base64;
import java.util.Date;

/**
 * 功能描述: TODO
 *
 * @author SunFeihu 孙飞虎
 * @date 2018/8/7
 */
public class EUser implements Parcelable {

    long userId;
    //昵称
    String userName;
    //性别
    String userSex;
    //城市
    String userAddress;
    //财力
    long userWealth;
    //魅力
    long userCharm;
    //url
    String userUrl;
    //特权到期时间
    String userVipTime;

    boolean vip;

    public EUser() {
    }

    protected EUser(Parcel in) {
        userId = in.readLong();
        userName = in.readString();
        userSex = in.readString();
        userAddress = in.readString();
        userWealth = in.readLong();
        userCharm = in.readLong();
        userUrl = in.readString();
        userVipTime = in.readString();
        vip = in.readByte() != 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeLong(userId);
        dest.writeString(userName);
        dest.writeString(userSex);
        dest.writeString(userAddress);
        dest.writeLong(userWealth);
        dest.writeLong(userCharm);
        dest.writeString(userUrl);
        dest.writeString(userVipTime);
        dest.writeByte((byte) (vip ? 1 : 0));
    }

    @Override
    public int describeContents() {
        return 0;
    }

    public static final Creator<EUser> CREATOR = new Creator<EUser>() {
        @Override
        public EUser createFromParcel(Parcel in) {
            return new EUser(in);
        }

        @Override
        public EUser[] newArray(int size) {
            return new EUser[size];
        }
    };

    public long getUserId() {
        return userId;
    }

    public String getUserName() {

        return BaseAppContent.decode(userName);
    }

    public String getUserSex() {
        return userSex;
    }

    public String getUserAddress() {
        return userAddress;
    }

    public long getUserWealth() {
        return userWealth;
    }

    public long getUserCharm() {
        return userCharm;
    }

    public String getUserUrl() {
        return userUrl;
    }

    public String getUserVipTime() {
        return userVipTime;
    }

    public boolean isVip() {
        return vip;
    }
}
